/*
 * Created on Oct 27, 2004
 *
 * 2004-11-24 Nathan Anderson [nanderson@melinate.com]
 * - modified test to compile after adding case sensitive
 *   logic.  Test will not work for case sensitive DB's
 *   but at least it continues to work for other DB's
 */
package com.codegenerator.testcases;

import com.codegenerator.common.ThreadContext;
import com.codegenerator.db.SqlTable;

import junit.framework.TestCase;

/**
 * @author MF1180
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TestSqlTable extends TestCase {

	SqlTable sqlTable = null;
	
	public static void main(String[] args) {
	}

	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();
		sqlTable = new SqlTable("menu_item", "", false, "menu_item");
	}

	/*
	 * @see TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		super.tearDown();
		sqlTable = null;
		ThreadContext.getCurrentContext().terminate(true);
	}


	public void testSqlTable() {
		assertEquals("MENU_ITEM", sqlTable.getTable());
		assertEquals("MENU_ITEM", sqlTable.getEntityName());
		assertEquals("",  sqlTable.getSchema());
		assertTrue(sqlTable.getAllColumns().size() == 20);
		assertTrue(sqlTable.getPrimaryKeys().size() > 0);
		assertTrue(sqlTable.getPrimaryKey(0).isKey());
		assertTrue(sqlTable.getPrimaryKey(0).getColname().equalsIgnoreCase("MENU_ID"));
	}

}
